﻿Public Class FrmRegistrarCredencialesCliente

    Private Sub picAtras_Click(sender As Object, e As EventArgs) Handles picAtras.Click
        For Each x As Control In Me.Parent.Controls.OfType(Of FrmRegistrarCliente)()
            x.Visible = True
        Next
        Me.Visible = False
    End Sub

    Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
        FrmTransparente.Close()
    End Sub

    Private Sub btnSiguiente_Click(sender As Object, e As EventArgs) Handles btnSiguiente.Click

        lblCarneReq.Visible = False
        lblContrasenaReq.Visible = False
        lblConfirmacionReq.Visible = False
        lblCoincide.Visible = False

        Dim requeridos As New List(Of TextBox)
        requeridos.Add(txtNumeroCarne)
        requeridos.Add(txtContrasena)
        requeridos.Add(txtConfirmacion)

        For Each txtBox As TextBox In requeridos
            If txtBox.Text = "" Then
                Select Case txtBox.Name
                    Case "txtNumeroCarne"
                        lblCarneReq.Visible = True
                    Case "txtContrasena"
                        lblContrasenaReq.Visible = True
                    Case "txtConfirmacion"
                        lblConfirmacionReq.Visible = True
                End Select
            End If
        Next

        If txtContrasena.Text <> txtConfirmacion.Text Then
            lblCoincide.Visible = True
        End If

        If txtNumeroCarne.Text <> "" And txtContrasena.Text <> "" And txtConfirmacion.Text <> "" And txtContrasena.Text = txtConfirmacion.Text Then

            Dim entro As Boolean = False
            For Each x As Control In Me.Parent.Controls.OfType(Of FrmRegistrarFotografiaCliente)()
                x.Visible = True
                entro = True
            Next

            If Not entro Then
                Dim frm As New FrmRegistrarFotografiaCliente()
                frm.Dock = DockStyle.Fill
                Me.Parent.Controls.Add(frm)
            End If
            Me.Visible = False
        End If
        
    End Sub

    Private Sub FrmRegistrarCredencialesCliente_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        If Screen.PrimaryScreen.WorkingArea.Height < 900 Then
            Me.AutoScroll = True
        End If
    End Sub
End Class
